home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / watchkat.zip / WATCHCAT.LST < prev    next >
File List  |  1989-08-23  |  26KB  |  495 lines

  1. Turbo Assembler  Version 1.0        11-21-89 20:57:32         Page 1
  2. WATCHCAT.ASM
  3.  
  4.       1 0000                          .model tiny
  5.       2 0000                          .code
  6.       3 0000                         first:
  7.       4                              ;
  8.       5                              ; WATCHCAT copyright 1989, Joseph R. Ahlgren
  9.       6                              ;  see WATCHCAT.DOC
  10.       7                              ;
  11.       8                              ; WATCHCAT performs 5 critical functions for any RBBS system:
  12.       9                              ;  1.  Reboots system if no carrier in specified period of time
  13.      10                              ;    This catches RBBS or system failures
  14.      11                              ;  2.  Reboots system if carrier lost during critical period
  15.      12                              ;    This allows Doors to be used safely
  16.      13                              ;  3.  Reboots system if 20 rings without answering phone
  17.      14                              ;    This allows system to be restarted by phone
  18.      15                              ;  4.  Reboots system if "Hit any key to return to system" message appears
  19.      16                              ;    This restarts system on a common RBBS failure
  20.      17                              ;  5.  Drops carrier if L&R shift keys pressed simultaneously
  21.      18                              ;    This allows users to be logged off without a nasty message.
  22.      19                              ;WATCHCAT loads the TSR and disables all functions
  23.      20                              ; WATCHCAT OFF disables all functions
  24.      21                              ; WATCHCAT ON enables 1,3,4,and 5
  25.      22                              ; WATCHCAT TIMER enables 2,4,and 5
  26.      23                              ;ComPort = 03f8h  ;{COM1}
  27.      24                              ;ComPort = 02f8h  ;{COM2}
  28.      25                              ;ComPort = 03e8h  ;{COM3}
  29.      26                              ;ComPort = 02e8h  ;{COM4}
  30.      27                              ;ScreenSegment = 0b800h  ;{Color}
  31.      28                              ;ScreenSegment = 0b000h  ;{Mono}
  32.      29       = 0006                 ModemStatus = 0006h
  33.      30       = 0004                 ModemControl = 0004h
  34.      31       = 0080                 CarrierDetect = 0080h
  35.      32       = 0040                 RingIndicator = 0040h
  36.      33       = 0444                 tpm = 1092 ; {ticks per minute}
  37.      34       = 006E                 RingTicks = 110; {6 seconds}
  38.      35                               org 100h
  39.      36 0100                         start:
  40.      37 0100  E9 010F                 jmp init
  41.      38 0103  0000                   RingTrigger dw 0
  42.      39 0105  00                     RingTimer db 0
  43.      40 0106  06                     Flag db 'F' and 0fh  ;  OFF ON TIME = F O I
  44.      41 0107  ????????               TimerInt dd ?
  45.      42 010B  01E0                   Minutes dw 8*60  ;{minutes of no carrier to trigger reset}
  46.      43 010D  0444                   Seconds dw tpm
  47.      44 010F  01E0                   MinReset dw 8*60
  48.      45 0111  FFFF0000               ColdBoot dd 0ffff0000h
  49.      46 0115  00                     ExitTimer db 0
  50.      47 0116  03                     DropTrigger db 3  ;Drop DTR on L&R shift
  51.      48 0117  48 69 74 20 61 6E 79 + ExitMessage db 'Hit any key to return to system'
  52.      49       20 6B 65 79 20 74 6F +
  53.      50       20 72 65 74 75 72 6E +
  54.      51       20 74 6F 20 73 79 73 +
  55.      52       74 65 6D
  56.      53 0136  00                     ExitMessageEnd db 0
  57.      54 0137  02F8                   ComPort dw 02f8h  ;{COM2}
  58.      55 0139  B000                   ScreenSegment dw 0b000h  ;{Mono}
  59.      56 013B  6A 4F 65 59            Ident db "jOeY"
  60.      57 013F  35 30 63 34            Ident2 db "50c4"
  61.      58 0143                         timer:
  62.      59                               assume ds:nothing,es:nothing,ss:nothing
  63. Turbo Assembler  Version 1.0        11-21-89 20:57:32         Page 2
  64. WATCHCAT.ASM
  65.  
  66.      60 0143  2E: 80 3E 0106r 06      cmp cs:[Flag],'F' and 0fh
  67.      61 0149  75 05                   jne SystemOn
  68.      62 014B  2E: FF 2E 0107r         jmp cs:[TimerInt]
  69.      63 0150                         SystemOn:
  70.      64 0150  50                      push ax
  71.      65 0151  52                      push dx
  72.      66 0152  1E                      push ds
  73.      67                              ;  4.  Reboots system if "Hit any key to return to system" message appears
  74.      68                              ;    This restarts system on a common RBBS failure
  75.      69 0153  2E: FE 0E 0115r         dec cs:[ExitTimer]
  76.      70 0158  75 2C                   jnz NoExitLoop
  77.      71 015A  51                      push cx
  78.      72 015B  56                      push si
  79.      73 015C  57                      push di
  80.      74 015D  2E: A1 0139r            mov ax,cs:[ScreenSegment]
  81.      75 0161  8E D8                   mov ds,ax
  82.      76 0163  B9 0019                 mov cx,25
  83.      77 0166  33 F6                   xor si,si
  84.      78 0168                         SSLoop1:
  85.      79 0168  51                      push cx
  86.      80 0169  56                      push si
  87.      81 016A  B9 001F                 mov cx,ExitMessageEnd-ExitMessage
  88.      82 016D  BF 0117r                mov di,offset ExitMessage
  89.      83 0170                         SSLoop2:
  90.      84 0170  AD                      lodsw
  91.      85 0171  2E: 3A 05               cmp al,cs:[di]
  92.      86 0174  75 05                   jne SSLoop2x
  93.      87 0176  47                      inc di
  94.      88 0177  E2 F7                   loop SSLoop2
  95.      89 0179  EB 6D                   jmp short NoCarrier
  96.      90 017B                         SSLoop2x:
  97.      91 017B  5E                      pop si
  98.      92 017C  59                      pop cx
  99.      93 017D  81 C6 00A0              add si,160
  100.      94 0181  E2 E5                   loop SSLoop1
  101.      95 0183  5F                      pop di
  102.      96 0184  5E                      pop si
  103.      97 0185  59                      pop cx
  104.      98 0186                         NoExitLoop:
  105.      99                              ;  5.  Drops carrier if L&R shift keys pressed simultaneously
  106.     100                              ;    This allows users to be logged off without a nasty message.
  107.     101 0186  33 C0                   xor ax,ax
  108.     102 0188  8E D8                   mov ds,ax
  109.     103                               assume ds:Lowmem
  110.     104 018A  A0 0417r                mov al,[ShiftStatus]
  111.     105 018D  24 0F                   and al,0fh
  112.     106 018F  2E: 3A 06 0116r         cmp al,cs:[DropTrigger]
  113.     107 0194  75 0C                   jne NoShift
  114.     108 0196  2E: 8B 16 0137r         mov dx,cs:[ComPort]
  115.     109 019B  83 C2 04                add dx,ModemControl
  116.     110 019E  EC                      in al,dx
  117.     111                              ; or al,1
  118.     112 019F  24 FE                   and al,0feh
  119.     113 01A1  EE                      out dx,al       ;drop DTR
  120.     114 01A2                         NoShift:
  121.     115                              ;  3.  Reboots system if 20 rings without answering phone
  122.     116                              ;    This allows system to be restarted by phone
  123.     117 01A2  2E: 8B 16 0137r         mov dx,[ComPort]
  124.     118 01A7  83 C2 06                add dx,ModemStatus
  125. Turbo Assembler  Version 1.0        11-21-89 20:57:32         Page 3
  126. WATCHCAT.ASM
  127.  
  128.     119 01AA  EC                      in al,dx
  129.     120 01AB  A8 40                   test al,RingIndicator
  130.     121 01AD  74 06                   jz NotRinging
  131.     122 01AF  2E: 83 0E 0103r 01      or cs:[RingTrigger],1
  132.     123 01B5                         NotRinging:
  133.     124 01B5  2E: FE 0E 0105r         dec cs:[RingTimer]
  134.     125 01BA  75 15                   jnz NoRingTime
  135.     126 01BC  2E: C6 06 0105r 6E      mov cs:[RingTimer],RingTicks
  136.     127 01C2  2E: A1 0103r            mov ax,cs:[RingTrigger]
  137.     128 01C6  3D FFFF                 cmp ax,0ffffh
  138.     129 01C9  74 1D                   je NoCarrier
  139.     130 01CB  D1 E0